package com.qeegoo.b2bautozityp.moudle.good.adapter;

import com.chad.library.adapter.base.BaseSectionQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.qeegoo.b2bautozityp.R;
import com.qeegoo.b2bautozityp.moudle.good.entity.MySection;
import com.qeegoo.b2bautozityp.moudle.good.model.GoodsCategoryBean;

import java.util.List;

/**
 * 王少岩 在 2017/9/20 创建了它
 */

public class CategoryAdapter extends BaseSectionQuickAdapter<MySection<GoodsCategoryBean>, BaseViewHolder> {
    /**
     * Same as QuickAdapter#QuickAdapter(Context,int) but with
     * some initialization data.
     *
     * @param data             A new list is created out of this one to avoid mutable list
     */
    public CategoryAdapter(List<MySection<GoodsCategoryBean>> data) {
        super(R.layout.adapter_goods_category_content, R.layout.adapter_goods_category_header, data);
    }

    @Override
    protected void convertHead(BaseViewHolder holder, MySection item) {
        holder.setText(R.id.tv_title, item.header);
    }

    @Override
    protected void convert(BaseViewHolder holder, MySection<GoodsCategoryBean> item) {
        holder.setText(R.id.tv_subtitle, item.t.name);
    }
}
